@extends('admin/layout')

@if($script_blade = 'news/index')@endif

@section('content')
<div class="page-header clearfix">
    <h1 class="pull-left">资讯管理</h1>
    <a class="btn btn-info btn-sm pull-right" href="{{ url('admin/news/create') }}">添加新资讯</a>
</div>
<form class="form-inline" action="">
    <div class="well well-sm">
        <div class="form-group">
            <label for="role"></label>
            <select class="form-control" name="role" id="role">
                <option value="">--所有角色--</option>
                <option value="">管理员</option>
                <option value="">老师</option>
                <option value="">学生</option>
            </select>
        </div>
        <div class="form-group">
            <label for="status"></label>
            <select class="form-control" name="status" id="status">
                <option value="">全部状态</option>
                <option value="">启用</option>
                <option value="">关闭</option>
            </select>
        </div>
        <div class="form-group">
            <label for="keyword"></label>
            <input type="text" name="keyword" id="keyword" class="form-control" placeholder="关键词"/>
        </div>
        <button class="btn btn-primary"> 搜索 </button>
    </div>
</form>
<table class="table table-hove">
    <tr>
        <th>ID</th>
        <th>标题</th>
        <th>作者</th>
        <th>创建时间</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    @foreach($news as $new)
    <tr>
        <td>{{ $new->id }}</td>
        <td><a href="">{{ $new->title }}</a></td>
        <td>{{ $new->author }}</td>
        <td>{{ $new->createTime | date('Y-m-d') }}</td>
        <td>
            @if($new->status == 1)
            <span class="text-success">已发布</span>
                @else
                <span class="text-muted">未发布</span>
            @endif
        </td>
        <td>
            <div class="btn-group">
                <a class="btn btn-default btn-sm" href="{{ url('admin/news/'.$new->id.'/edit') }}"><i class="glyphicon glyphicon-edit"></i> edit</a>
                <button class="btn btn-default btn-sm del-btn"  data-url="{{ url('admin/news/'.$new->id) }}"><i class="glyphicon glyphicon-trash"></i> trash</button>
            </div>
        </td>
    </tr>
    @endforeach
</table>
<?php echo $news->render()?>
@endsection